package cn.johnyu.mapper;

import cn.johnyu.pojo.Product;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface ProductMapper {
    @Insert("insert into products (name,stock) values (#{p.name},#{p.stock})")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    int addProduct(@Param(value = "p") Product product);
}
